package com;

import com.tjetc.utils.App;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class Test {
    public static void main(String[] args) {
        Date date= null;
        while (true) {
            try {
                System.out.println("请输入要添加的比赛时间:   (年-月-日)");
                SimpleDateFormat time=new SimpleDateFormat("yyyy-MM-dd");
                String str= App.scanner.next();
                date = time.parse(str);
            } catch (ParseException e) {
                e.printStackTrace();
            }
            if (date==null){
                System.out.println("输入错误请重新输入时间");
            }else {
                System.out.println(date);
                break;
            }
        }
    }
}
